package adil.common.jfinal.controller;

import adil.common.jfinal.plugin.acitiviti.ActivitiProcessEngineService;
import com.jfinal.core.Controller;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.repository.Deployment;
import org.activiti.engine.runtime.ProcessInstance;
import org.junit.Test;

import java.io.InputStream;
import java.util.zip.ZipInputStream;

/**
 * Created by 李园 - Adil on 2017/11/2.
 */
public class TestStartProcess {
    private RepositoryService repositoryService;
//    private ActivitiProcessEngineService  apes= enhance(ActivitiProcessEngineService.class);


    @Test
    public void deployProcess(){
        InputStream in = this.getClass().getClassLoader().getResourceAsStream("bpmn/helloworld.zip");
        ZipInputStream inputStream = new ZipInputStream(in);
        Deployment deployment =repositoryService.createDeployment()
                    .addZipInputStream(inputStream)
                    .deploy();
        System.out.println("部署执行完毕");
    }

    public void startProcessInstance(){
        deployProcess();
        String key = "helloworld";
//        ProcessInstance pi   = apes.getRuntimeService().startProcessInstanceByKey(key);
//        System.out.println("流程实例ID"+pi.getId());
//        System.out.println("流程定义DI"+pi.getProcessDefinitionId());


    }

}
